package org.ws.lifebacklog.db;

import java.util.ArrayList;
import java.util.List;

import org.ws.lifebacklog.model.Task;

import android.database.Cursor;

/**
 * @author Walter
 * 
 */
public class TaskDao {

	private DatabaseHelper mHelper;

	/**
	 * @param
	 */
	public TaskDao(DatabaseHelper helper) {
		mHelper = helper;
	}

	public List<Task> getTasks() {
		List<Task> tasks = new ArrayList<Task>();
		Cursor cur = mHelper.getReadableDatabase().rawQuery("SELECT * FROM TASK", null);
		for (int i = 0; i < cur.getCount(); i++) {
			cur.moveToPosition(i);
			tasks.add(new Task(cur));
		}
		cur.close();
		return tasks;
	}

}
